| Name | Message | Date |
|---|---|---|
| 📄 +page.svelte | 1 month ago | |
| 📄 +page.ts | 1 month ago |
📄
src/routes/guide/[labelIndex]/+page.svelte
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
<script lang="ts">
import { historyStore } from "$lib/history";
import { labelsStore } from "$lib/labels";
import PatchBanner from "$lib/components/PatchBanner.svelte";
import HistoryEntry from "$lib/components/HistoryEntry.svelte";
let { data } = $props();
const label = $derived($labelsStore[data.labelIndex]);
const detections = $derived(
$historyStore.filter((e) => e.labelIndex === data.labelIndex),
);
</script>
<PatchBanner text={label?.commonName ?? "Unknown Bird"} />
<div class="species-info">
{#if label}
<p class="scientific">{label.scientificName}</p>
{/if}
<p class="stat">
{detections.length}
{detections.length === 1 ? "detection" : "detections"}
</p>
</div>
{#if detections.length > 0}
<ol>
{#each detections as entry (entry.detectedAt)}
<HistoryEntry {entry} />
{/each}
</ol>
{:else}
<p class="empty">Not detected yet. Go listen!</p>
{/if}
<style>
.species-info {
padding: 1.25rem 1rem 0.5rem;
display: flex;
flex-direction: column;
gap: 0.25rem;
}
.scientific {
font-style: italic;
font-size: 0.9rem;
opacity: 0.7;
}
.stat {
font-weight: 700;
color: var(--brand-red);
}
.empty {
padding: 3rem 1.5rem;
text-align: center;
color: var(--accent-rust);
}
ol {
list-style: none;
padding: 1rem;
padding-top: 0.75rem;
padding-bottom: calc(var(--nav-height) + env(safe-area-inset-bottom) + 1rem);
display: flex;
flex-direction: column;
gap: 0.75rem;
}
</style>